package com.msl;

import android.app.Application;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;

import com.msl.dao.DaoMaster;
import com.msl.dao.DaoSession;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by de on 2018/7/12.
 */

public class MslApp extends Application {
    private String tag ="MslApp";
    public static final String TAG = MslApp.class.getSimpleName();
    public static DaoSession daoSession;
    public static SharedPreferences sSharedPreferences;
    public static SharedPreferences.Editor sEditor;
    public static final String SHARE_KEY="SHARE_KEY";
    public final static String appInfo = "appinfo";
    public final static String addk = "addk";
    public final static String cidk = "cidk";
    public final static String userk = "userk";
    public final static String pwk = "pwk";
    public final static String usertype = "usertype";
    public final static String userID = "userID";
    public final static String storeID = "storeID";
    public final static String codedea = "codedea";
    public final static String datac = "datac";
    public final static String datacc = "datacc";
    public final static String mainicons = "mainicons";

    public  static String url = "http://mls.zaosin.cn/pda/StorePDAWebService.ashx";
    public  static String address = "/pda/StorePDAWebService.ashx";
    public static List<String> listcode = new ArrayList<String>();
    public  static String id1="";
    public static String id2="";
    public static String id3="";

    @Override
    public void onCreate() {
        super.onCreate();
        MslApp.sSharedPreferences = getSharedPreferences(SHARE_KEY, MODE_PRIVATE);
        MslApp.sEditor = MslApp.sSharedPreferences.edit();
        setupDatabase();
    }


    public void setupDatabase() {
        //创建数据库shop.db
        DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(this, "code.db", null);
        //获取可写数据库
        SQLiteDatabase db = helper.getWritableDatabase();
        //获取数据库对象
        DaoMaster daoMaster = new DaoMaster(db);
        //获取dao对象管理者
        daoSession = daoMaster.newSession();
    }





}
